﻿using System;
using Serveur.DataAccess;
using CommonLibrary;
using DBO;
using DBO.Economy;

namespace BusinessManagement
{
    /// <summary>
    /// This singleton contains all dictionaries and context information needed for the server.
    /// </summary>
    public sealed class ServerDataSingleton
    {
        private ServerDataSingleton()
        {
            createDictionaries();
        }

        public static readonly ServerDataSingleton Instance = new ServerDataSingleton();

        public DictionnaryRepository ResourceRepository { get { return _resDict; } }

        private void createDictionaries()
        {
            _resDict = new DictionnaryRepository();

            _resDict.RegisterDictionnary<UnitStatistics>(new StatisticsDictionary());
            _resDict.RegisterDictionnary<Race>(new RaceDictionary());
            _resDict.RegisterDictionnary<Resources>(new ResourcesDictionary());
        }

        private DictionnaryRepository _resDict;
    }
}
